home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $VER: HuntFile.bed 1.1 (21.04.96)
- **
- ** Hunt the current file under the cursor. Not perfect by far, but it works
- ** for simple includes and other simple files in the current dir :)
- **
- ** Written by Gerbert Nuijen
- */
-
- OPTIONS RESULTS
-
- GetChar
- IF RESULT="" | RESULT="RESULT" | RESULT= " " THEN DO
- SetStatusBar "Cursor not on a (correct) word!"
- Exit
- END
-
- break=FALSE
-
- DO WHILE break=FALSE
- Getchar
- char = RESULT
- IF char="<" THEN DO
- break=TRUE
- endchar=">"
- MoveRight
- END
- IF char=" " | char="RESULT" THEN DO /* If it is an Return code, RESULT
- is given as a RESULT of GetChar */
- break=TRUE
- endchar=" "
- MoveRight
- END
- MoveLeft
- END
-
- exe=""
-
- DO WHILE char ~= endchar
- MoveRight
- GetChar
- char = RESULT
- IF char="RESULT" | char=endchar THEN DO /* that's for return codes */
- char=endchar
- END
- ELSE DO
- exe = exe || char
- END
- END
-
- ExistsFile exe
-
- IF RESULT = "YES" THEN DO
- OpenDoc exe
- EXIT
- END
- ELSE DO
- exe = "Include:" || exe
- ExistsFile exe
- IF RESULT = "YES" THEN DO
- OpenDoc exe
- END
- ELSE DO
- SetStatusBar "Can't find file! : " || exe
- END
- END
-